package day14.com.zhiyou100;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Demo01 {
    public static void main(String[] args) {
        Collection<Double> collection = new ArrayList<>();
        collection.add(3.14);
        collection.add(3.5);
        collection.add(3.8);
        // 获取它对应的迭代器
        Iterator<Double> iterator = collection.iterator();
        while (iterator.hasNext()) {
            Double aDouble = iterator.next();
            System.out.println(aDouble);
            //iterator.remove();
        }
//        System.out.println(iterator.next());
        // 开始产生迭代
        /*boolean isNext1 = iterator.hasNext();
        System.out.println(isNext1);// true
        if (isNext1) {
            Double aDouble = iterator.next();
            System.out.println(aDouble);// 3.14
        }
        boolean isNext2 = iterator.hasNext();
        Double aDouble2 = iterator.next();
        System.out.println(aDouble2);
        boolean isNext3 = iterator.hasNext();
        Double aDouble3 = iterator.next();
        System.out.println(aDouble3);
        boolean isNext4 = iterator.hasNext();
        Double aDouble4 = iterator.next();
        System.out.println(aDouble4);*/

    }
}
